package com.yltrcc.blog.controller.api;

import com.yltrcc.blog.model.model.BaseApiResponse;
import com.yltrcc.blog.business.WeChatEntEntService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * 企业微信 群推送APi
 */
@RestController
@RequestMapping(value = "/api/wechat_ent")
public class WechatEntApiController {

    @Autowired
    private WeChatEntEntService weChatEntService;

    @GetMapping("/sendDailySummaryMsg")
    public BaseApiResponse getArticle() {
        ArrayList<String> mobileList = new ArrayList<>();
        mobileList.add("@All");
        weChatEntService.sendTextMsg("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=8c416c63-a4b6-474d-8ff1-a040357f5595&debug=1",
                "广州今日天气：29度，大部分多云，降雨概率：60%", mobileList);

        return new BaseApiResponse();
    }


    @GetMapping("/sendRandomArticle")
    public BaseApiResponse sendRandomArticle() {

        weChatEntService.sendRandomArticle();

        return new BaseApiResponse();
    }
}
